package com.google.code.jholidays.events.properties;

import com.google.code.jholidays.core.EventDescriptor;
import com.google.code.jholidays.events.IEvent;

/**
 * Provides skeletal implementation of {@link IEventProperties} interface.
 * <p>
 * Base class for several subclasses which are used during construction of
 * built-in events
 * 
 * @author tillias
 * @see FixedEventProperties
 * @see FloatingEventProperties
 * @see DependentEventProperties
 */
public abstract class AbstractEventProperties implements IEventProperties {

    /**
     * Sole constructor. For invocation by subclasses
     * 
     * @param descriptor
     *            Event descriptor
     * @param parent
     *            Parent event
     * @throws IllegalArgumentException
     *             Thrown if descriptor parameter passed to constructor is null
     */
    protected AbstractEventProperties(EventDescriptor descriptor, IEvent parent)
	    throws IllegalArgumentException {
	if (descriptor == null)
	    throw new IllegalArgumentException("Event descriptor is null");

	this.descriptor = descriptor;
	this.parent = parent;
    }

    @Override
    public EventDescriptor getDescriptor() {
	return descriptor;
    }

    @Override
    public IEvent getParent() {
	return parent;
    }

    EventDescriptor descriptor;
    IEvent parent;
}
